package org.example.im.client.handler;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import org.example.im.bean.protocol.response.ListGroupMemberResponsePacket;
import org.example.im.bean.session.Session;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author dingrui
 * @since 2022/2/12
 * @description 群成员信息
 */
@Component
public class ListGroupMemberResponseHandler extends SimpleChannelInboundHandler<ListGroupMemberResponsePacket> {

    @Override
    protected void channelRead0(ChannelHandlerContext channelHandlerContext, ListGroupMemberResponsePacket listGroupMemberResponsePacket) throws Exception {
        String groupId = listGroupMemberResponsePacket.getGroupId();
        List<Session> sessionList = listGroupMemberResponsePacket.getSessionList();
        System.out.println("[C-ListGroupMember] 群[" + groupId + "]中成员如下: " + sessionList);
    }
}
